﻿using Sidvall.IO;

namespace Sidvall.UI.Dialogs
{
    public class FileDialogContext
    {
        #region Public Members

        public string FileName { get; set; }
        public int FilterIndex { get; set; }
        public string DefaultExtension { get; set; }
        public Sidvall.IO.FolderType? InitialFolder { get; set; }
        public bool CheckPathExists { get; set; }

        #region Filter

        public string Filter
        {
            get
            {
                return this.FileTypeChoices.ToString();
            }
            set
            {
                this.FileTypeChoices = FileTypeChoiceCollection.Parse(value);
            }
        }

        #endregion
        #region FileNames

        private System.Collections.ObjectModel.Collection<string> _FileNames;
        public System.Collections.ObjectModel.Collection<string> FileNames
        {
            get
            {
                if (_FileNames == null)
                    _FileNames = new System.Collections.ObjectModel.Collection<string>();
                return _FileNames;
            }
        }

        #endregion
        #region FileTypeChoices

        private FileTypeChoiceCollection _FileTypeChoices;
        public FileTypeChoiceCollection FileTypeChoices
        {
            get
            {
                if (_FileTypeChoices == null)
                    _FileTypeChoices = new FileTypeChoiceCollection();
                return _FileTypeChoices;
            }
            private set
            {
                _FileTypeChoices = value;
            }
        }

        #endregion

        #endregion
        #region Constructor

        public FileDialogContext()
        {
            this.FilterIndex = 1;
            this.CheckPathExists = true;
        }

        #endregion
    }
}
